package com.model.dto.sys.userController;

import com.common.anntation.SetNotNull;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.*;
import java.util.Set;

@Data
public class UpdateUserInfoListDTO {

    @ApiModelProperty(value = "用户列表",required = true)
    @NotNull(message = "userInfoSet不能为空")
    @Valid
    Set<UserInfo> userInfoSet;

    @Data
    public static class UserInfo {
            @ApiModelProperty(value = "用户id",required = true)
            @NotNull(message = "sysUserId不能为空")
            Long sysUserId;

            @ApiModelProperty(value = "部门id")
            Long sysDeptId;

            @ApiModelProperty(value = "显示名称长度限制为128")
            @Size(min = 0, max = 128, message = "显示名称长度限制为128")
            String fullName;

            @ApiModelProperty(value = "用户名不能为空，用户名长度限制为50，用户名只允许26个英文字母或英文+数字",required = true)
            @Size(min = 1, max = 50, message = "用户名长度限制为50")
            @Pattern(regexp = "^[A-Za-z][A-Za-z0-9]+$", message = "用户名只允许26个英文字母或英文+数字")
            String name;

            @ApiModelProperty(value = "手机号")
            @Size(min = 0, max = 11, message = "手机号长度为11位")
            @Pattern(regexp = "^[0-9]*$", message = "手机号只能是数字")
            String mobile;

            @ApiModelProperty(value = "邮箱")
            @Size(min = 0, max = 50, message = "邮箱长度限制为50")
            @Pattern(regexp = "\\b[\\w.%+-]+@[\\w.-]+\\.[a-zA-Z]{2,6}\\b", message = "邮箱格式不合法")
            String email;

            @ApiModelProperty(value = "密码")
            @Size(min = 6, max = 120, message = "密码长度限制为120")
            String password;

            @ApiModelProperty(value = "绑定的角色id列表")
            @SetNotNull()
            Set<Long> sysRoleIds;
    }
}
